/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overscroll-behavior: none;
}

html, body {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #e8f0fe 0%, #f3e5f5 25%, #fce4ec 50%, #fff3e0 75%, #e3f2fd 100%);
    background-size: 300% 300%;
    animation: gradientShift 12s ease-in-out infinite;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    overscroll-behavior: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(102, 126, 234, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(118, 75, 162, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: floatingOrbs 15s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { 
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }
    25% {
        background-position: 100% 50%;
        filter: hue-rotate(15deg);
    }
    50% { 
        background-position: 50% 100%;
        filter: hue-rotate(30deg);
    }
    75% {
        background-position: 50% 0%;
        filter: hue-rotate(15deg);
    }
}

@keyframes floatingOrbs {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }
    33% {
        transform: translateY(-15px) rotate(120deg);
        opacity: 0.9;
    }
    66% {
        transform: translateY(10px) rotate(240deg);
        opacity: 0.6;
    }
}

/* 通用卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    animation: fadeInUp 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    animation: cardShimmer 3s ease-in-out infinite;
}

@keyframes cardShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 下拉框选项样式增强 */
.period-selector option {
    background: rgba(255, 255, 255, 0.95);
    color: #1d1d1f;
    padding: 8px 12px;
    font-weight: 500;
    border: none;
}

.period-selector option:hover,
.period-selector option:checked {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

/* 表格容器 - 不使用card样式 */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 表格样式 */
table {
    width: 100%;
    min-width: 900px; /* 减小最小宽度，因为列变窄了 */
    border-collapse: collapse;
    position: relative;
}

th, td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 11px;
    line-height: 1.3;
    min-width: 70px;
    max-width: 90px;
}

.header-group th {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    font-weight: 700;
    font-size: 12px;
    color: #1e293b;
    text-align: center;
    padding: 10px 6px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    border-bottom: 2px solid #cbd5e1;
    min-width: 60px;
}

.header-detail th {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    font-weight: 600;
    font-size: 10px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.9);
    min-width: 60px;
}

.group-current {
    border-bottom: 3px solid #007aff;
    background: linear-gradient(135deg, #e8f3ff 0%, #f0f7ff 100%) !important;
    color: #0056b3 !important;
}

.group-recent {
    border-bottom: 3px solid #ff9500;
    background: linear-gradient(135deg, #fff3e0 0%, #fff8f0 100%) !important;
    color: #cc7700 !important;
}

.current-data {
    color: #007aff;
}

.recent-data {
    color: #ff9500;
    font-weight: 600;
}

/* 只在昨日流水和日均流水之间加简单分割线 */
.separator-column {
    border-left: 2px solid rgba(255, 149, 0, 0.4) !important;
}

/* 产品列固定和样式 */
.product-header,
.product-name {
    position: sticky !important;
    left: 0 !important; /* 修改为0，确保固定在最左边 */
    z-index: 10 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    text-align: center !important;
    font-weight: 600;
    color: #1d1d1f;
    min-width: 85px !important;
    max-width: 85px !important;
    border-right: 2px solid rgba(255, 193, 7, 0.4) !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1) !important;
}

.product-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    z-index: 11 !important;
    font-weight: 700;
}

.highlight {
    font-weight: 600;
    color: #007aff;
}

.up {
    color: #ff3b30; /* 红色表示上涨 */
    font-weight: 600;
}

.down {
    color: #34c759; /* 绿色表示下跌 */
    font-weight: 600;
}

.percent {
    font-size: 10px;
    display: block;
    margin-top: 2px;
    margin-left: 0;
}

.total-row {
    background: rgba(0, 122, 255, 0.05);
    font-weight: 600;
}

.total-label {
    font-weight: 700;
    color: #1d1d1f;
}

/* 图表卡片 */
.chart-card {
    height: 400px;
    position: relative;
}

.historical-card {
    height: 580px;
    position: relative;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* 历史图表canvas高度控制 */
.historical-card canvas {
    max-height: 500px !important;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0;
}

.period-selector {
    padding: 8px 32px 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px) saturate(150%);
    -webkit-backdrop-filter: blur(15px) saturate(150%);
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007aff' stroke-width='2'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
}

.period-selector:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 122, 255, 0.4);
    box-shadow: 
        0 6px 24px rgba(0, 0, 0, 0.08),
        0 0 0 3px rgba(0, 122, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.period-selector:focus {
    background: rgba(255, 255, 255, 1);
    border-color: #007aff;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 4px rgba(0, 122, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.period-selector:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* 版权信息 */
.footer {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 0;
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

.footer p {
    margin: 4px 0;
    color: #8e8e93;
    font-size: 12px;
    font-weight: 400;
}

.footer p:first-child {
    color: #1d1d1f;
    font-weight: 500;
}

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端响应式 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    table {
        min-width: 650px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 10px;
    }
    
    .header-group th {
        font-size: 12px;
        padding: 12px 6px;
    }
    
    .header-detail th {
        font-size: 9px;
        padding: 10px 6px;
    }
    
    .percent {
        font-size: 9px;
    }
    
    .chart-card {
        height: 300px;
    }
    
         .historical-card {
         height: 480px;
     }
    
         .card-header {
         flex-direction: row;
         justify-content: space-between;
         align-items: center;
         gap: 12px;
     }
     
     .card-title {
         font-size: 16px;
         text-align: left;
         flex: 1;
     }
     
     .period-selector {
         width: 100px;
         padding: 6px 24px 6px 8px;
         font-size: 11px;
         border-radius: 10px;
         background-size: 12px;
         background-position: right 6px center;
     }
    
         .footer p {
         font-size: 11px;
     }
     
     /* 移动端产品列调整 */
     .product-header,
     .product-name {
         min-width: 80px !important;
         max-width: 80px !important;
         font-size: 10px;
         left: 0 !important; /* 移动端也固定在最左边 */
     }
     
     .table-container {
         margin: 16px 0;
     }
 }